package com.ssy.lingxi.workflow.repository;

import com.ssy.lingxi.workflow.entity.ExternalTaskDefinition;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 外部流程定义Jpa仓库
 * @author 万宁
 * @version 2.0.0
 * @date 2021-04-21
 */
@Repository
public interface ExternalTaskRepository extends JpaRepository<ExternalTaskDefinition, Long>, JpaSpecificationExecutor<ExternalTaskDefinition> {
    @Transactional
    void deleteByProcessKey(String processKey);

    ExternalTaskDefinition findFirstByProcessKeyAndTaskType(String processKey, Integer taskType);

    List<ExternalTaskDefinition> findByProcessKeyAndTaskNameAndTaskType(String processKey, String taskName, Integer taskType);

    List<ExternalTaskDefinition> findByProcessKey(String processKey);
}
